import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App);
//重置css
import 'normalize.css/normalize.css';

// router路由
import router from "@/router";

// pinia状态管理
import store from "@/store";
app.use(store);

// mitt事务总线
import mitt from '@/plugins/mitt.js'
app.config.globalProperties.$mitt = mitt;

//引入自定义指令
import directives from './plugins/directives/index.js';
app.use(directives)

///引入公有方法，使用 this.$util.xxx
import * as methods from './util/index.js';
Object.keys(methods).forEach(k => {
    app.config.globalProperties.$util = methods[k]
});

//引入公共常量，使用 this.$setting.xxx
import setting from './config/setting.js';
app.config.globalProperties.$setting = setting;

//rem适配设置font-size
import { setRem } from './util/rem.js';
// 设置根元素的字体大小
setRem(375, 37.5);

//引入全局通用组件
import myComponents from './components/overall/overall.js';
Object.keys(myComponents).forEach(k => app.component(k, myComponents[k]));

app.use(router);
app.mount('#app');